#coding: utf-8

from django.http import HttpResponse
from polls.models import Poll
# from django.template import RequestContext, loader
from django.shortcuts import render
# from django.http import Http404
from django.shortcuts import get_object_or_404

def index(request):
	latest_poll_list	= Poll.objects.order_by('-pub_date')[:5]
	context				= {"latest_poll_list": latest_poll_list}
	return render(request, 'polls/index.html', context)

	return HttpResponse(template.render(context))

def detail(request, poll_id):
	poll	= get_object_or_404(Poll, pk=poll_id)
	return render(request, 'polls/detail.html', {'poll': poll})

def results(request, poll_id):
	return HttpResponse("You're looking at the results of poll %s." % poll_id)

def vote(request, poll_id):
	return HttpResponse("You're voting on poll %s" % poll_id)


